package com.nuanshui.heatedloan.order.integration.bean;

import com.nuanshui.heatedloan.order.integration.execute.handler.OrderHandler;
import com.nuanshui.heatedloan.order.integration.form.OrderExecuteForm;

import java.util.List;

/**
 * @Author: Gonzo
 * @Date 2017/4/13下午6:55
 * @since 1.4.2
 */
public class OrderHandlerMeta implements Comparable<OrderHandlerMeta>{

    private OrderHandler orderHandler;
    private int order;
    private String name;
    private List<Integer> supportOrderType; //支持的类型
    private List<Integer> notSupportOrderType; //不支持的类型


    public void setOrderHandler(OrderHandler orderHandler) {
        this.orderHandler = orderHandler;
    }

    public int getOrder() {
        return order;
    }

    public void setOrder(int order) {
        this.order = order;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Integer> getSupportOrderType() {
        return supportOrderType;
    }

    public void setSupportOrderType(List<Integer> supportOrderType) {
        this.supportOrderType = supportOrderType;
    }

    public List<Integer> getNotSupportOrderType() {
        return notSupportOrderType;
    }

    public void setNotSupportOrderType(List<Integer> notSupportOrderType) {
        this.notSupportOrderType = notSupportOrderType;
    }


    /**
     * 校验是否符合符合当前业务
     * @Author: Gonzo
     * @Date 2017/3/1513:56
     * @since 1.4.0
     */
    public boolean matches(OrderExecuteForm form){

        //大致逻辑就是，如果当前handler选择了支持的类型，那么就默认不选择的都是不支持的。如果选择了不支持的类型，那么默认不选择的都是支持的。
        //如果都没选择，则都是支持的

        return true;//如果都不包含，则默认都支持

    }

    public OrderHandler getOrderHandler() {
        return orderHandler;
    }

    @Override
    public int compareTo(OrderHandlerMeta orderHandler) {
        return (this.order - orderHandler.getOrder()) * -1;
    }

}
